package com.ruoyi.web.controller.tool;

import com.ruoyi.web.core.utils.Message;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
/* loaded from: TestSocketController.class */ public class TestSocketController {
    @Resource
    public SimpMessagingTemplate template;

    @RequestMapping({"/pushToAll"})
    @ResponseBody
    public void subscribe(@RequestBody Message msg) {
        this.template.convertAndSend("/topic/all", msg.getContent());
    }

    @MessageMapping({"/alone"})
    @RequestMapping({"/pushToOne"})
    @ResponseBody
    public void queue(@RequestBody Message msg) {
        System.out.println("进入方法");
        this.template.convertAndSendToUser(msg.getTo(), "/message", msg.getContent());
    }
}
